#ifndef __MONSTER_H__
#define __MONSTER_H__

#include "cocos2d.h"
#include "Unit.h"
#include <vector>
USING_NS_CC;
#define MOVE_ACTION_TAG 900
struct BaseValue
{
	int Entry;
	int maxheath;
	int Attack_Power;
	int Defance;
	float MissChance;
	float CritChance;
	int Level;
	int Loot;
	int reswardexp;
	int rewardmoney;
	std::string imageurl;
	std::string deadsoundurl;
	std::string takedamagesoundurl;
};

struct WaitingForDeleteNumbers
{
	std::vector<CCSprite*> Numbers;
	float DelayTime = 5.0f;
};

class Monster :public Unit
{
public:
	Monster(int Entry, int maxheath, int Attack_Power, int Defance, float MissChance, float CritChance, int Level, int Loot, int reswardexp, int rewardmoney, std::string imageurl, std::string deadsoundurl, std::string takedamagesoundurl);
	~Monster();
	void JustDead();
	int GetHeath()							{ return Heath; }
	void SetHeath(int number)				{ Heath = number; }
	float GetFallingSpeed()					{ return FallingSpeed; }
	void SetFallingSpeed(float f)			{ FallingSpeed = f; }
	const int GetLootID()					{ return _BaseValue.Loot; }
	const int GetEntry()					{ return _BaseValue.Entry; }
	void SetCanWalk(bool _val)				{ m_CanWalk = _val; }
	bool CanWalk()							{ return m_CanWalk; }
	void SetTarget(Unit* pTarget, float _CheckTimer = 60.0f);
private:
	virtual void update(float diff);
	void GetRandomMoving(bool _left);
	bool IsCrachedPlayer();
	CCAnimate* GetMoving();

private:
	std::vector<WaitingForDeleteNumbers*> WaitingDeleteNumberLines;
	float DeadTime;
	int Heath;
	float FallingSpeed;
	bool m_CanWalk;
	BaseValue _BaseValue;
	bool m_MovingType;
	float m_RandomMovingTimer;
	Unit* m_target;
	float m_target_chaeck_timer;
};

#endif